<div class="navButtonsTop rounded-corners">
	<h1 class="title"><g:message code="title.user.list"/></h1>
</div>

<div class="element rounded-corners">
	<g:if test="${userInstanceList}">
		<g:if test="${session.userViewMode == 'flow'}">
			<div class="scroll rounded-corners">
				<g:each in="${userInstanceList}" var="userInstance">
					<div class="item ${userInstance.disabled ? 'disableItem' : ''}" >
						<img class="portada" src="${resource(file:userInstance?.pathFileThumbnail)}" />
						
						<div class="resumen">
							<label>${userInstance.alias}</label>
						</div>
						
						<div class="botones">
							<g:form class="actionDefault" controller="user" action="show">
								<g:hiddenField name="id" value="${userInstance?.id}" />
								<g:submitButton class="itemButton showDetails" name="showDetails" value="${message(code:'default.button.details')}" />
							</g:form>
						</div>
					</div>
				</g:each>
			</div>
		</g:if>
			
		<g:if test="${session.userViewMode == 'list'}">
			<div class="rounded-corners tableList">
		        <table>
		            <thead>
		                <tr>
		                	<th><g:message code="default.label.actions"/></th>
		                	<usr:isAdmin>
		              	    	<g:sortableColumn property="id" titleKey="default.label.id" />
		              	    	<g:sortableColumn property="id" titleKey="default.label.disabled" />
		              	    </usr:isAdmin>
		              	    <g:sortableColumn property="alias" titleKey="default.label.alias" />
		              	    <g:sortableColumn property="name" titleKey="default.label.name" />
		              	    <g:sortableColumn property="lastName" titleKey="default.label.lastName" />
		              	    <usr:isAdmin>
		              	    	<g:sortableColumn property="email" titleKey="default.label.email" />
							</usr:isAdmin>		              	    
						</tr>
					</thead>
					<tbody>
						<g:each in="${userInstanceList}" status="i" var="userInstance">
		                	<tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
								<td><g:link action="show" id="${userInstance.id}"><g:message code="default.label.show"/></g:link></td>
								<usr:isAdmin>
									<td>${fieldValue(bean: userInstance, field: "id")}</td>
									<td>${fieldValue(bean: userInstance, field: "disabled")}</td>
								</usr:isAdmin>
								<td>${fieldValue(bean: userInstance, field: "alias")}</td>
		                       	<td>${fieldValue(bean: userInstance, field: "name")}</td>
		                       	<td>${fieldValue(bean: userInstance, field: "lastName")}</td>
		                       	<usr:isAdmin>
		                       		<td>${fieldValue(bean: userInstance, field: "email")}</td>
		                       	</usr:isAdmin>
		                   	</tr>
						</g:each>
		           	</tbody>
				</table>
			</div>
		</g:if>
	</g:if>
	
	<g:else>
		<div class="rounded-corners noData" >
			<g:message code="default.no.users"/>
		</div>
	</g:else>
</div>
	
<div class="paginateButtons rounded-corners">
	<div class="left">
		<g:paginate total="${userInstanceTotal}" />
	</div>
</div>